import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index, IsNull, Not } from 'typeorm';

/**
 * 用户信息
 */
@Entity('user_info')
export class UserInfoEntity extends BaseEntity {
  @Index({ unique: true })
  @Column({ comment: '登录唯一ID', nullable: true })
  unionid: string;

  @Column({ comment: '头像', nullable: true })
  avatarUrl: string;

  @Column({ comment: '昵称', nullable: true })
  nickName: string;

  @Column({ comment: '用户名 (从Oracle同步)', nullable: true })
  username: string;

  @Index({ unique: true })
  @Column({ comment: '手机号', nullable: true })
  phone: string;

  @Column({ comment: '性别', dict: ['未知', '男', '女'], default: 0 })
  gender: number;

  @Column({ comment: '状态', dict: ['禁用', '正常'], default: 1 })
  status: number;

  @Column({ comment: '登录方式', dict: ['小程序', '公众号', 'H5'], default: 0 })
  loginType: number;

  @Column({ comment: '密码', nullable: true })
  password: string;

  @Column({ comment: '介绍', type: 'text', nullable: true })
  description: string;

  @Column({ comment: 'ERP业务ID (Oracle ClientID)', nullable: true, unique: true })
  erpBusinessId: string;

  @Column({ comment: '真实姓名 (Oracle REALNAME)', nullable: true })
  realName: string;

  @Column({ comment: '地址 (Oracle ADDRESS)', type:'text', nullable: true })
  address: string;

  @Column({ comment: '固定电话 (Oracle TELEPHONE)', nullable: true })
  telephone: string;

  @Column({ comment: '区域名称 (Oracle AREANAME)', nullable: true })
  areaName: string;

  @Column({ comment: '等级ID (Oracle LEVELID)', nullable: true })
  levelId: string;

  @Column({ comment: '是否Pres (Oracle ISPRES)', nullable: true })
  isPres: string;
}
